package com.woniuxy.joylife.manager.controller;

import com.woniuxy.joylife.manager.entity.ActivityOwnerEntity;
import com.woniuxy.joylife.manager.service.ActivityOwnerService;
import com.woniuxy.joylife.manager.utils.PageUtils;
import com.woniuxy.joylife.manager.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;



/**
 * 活动报名信息
 *
 * @author renxiang
 * @email 981405195@qq.com
 * @date 2020-05-13 02:47:54
 */
@RestController
@RequestMapping("manager/activityowner")
public class ActivityOwnerController {
    @Autowired
    private ActivityOwnerService activityOwnerService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("manager:activityowner:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = activityOwnerService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{aoId}")
    //@RequiresPermissions("manager:activityowner:info")
    public R info(@PathVariable("aoId") String aoId){
		ActivityOwnerEntity activityOwner = activityOwnerService.getById(aoId);

        return R.ok().put("activityOwner", activityOwner);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("manager:activityowner:save")
    public R save(@RequestBody ActivityOwnerEntity activityOwner){
		activityOwnerService.save(activityOwner);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("manager:activityowner:update")
    public R update(@RequestBody ActivityOwnerEntity activityOwner){
		activityOwnerService.updateById(activityOwner);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("manager:activityowner:delete")
    public R delete(@RequestBody String[] aoIds){
		activityOwnerService.removeByIds(Arrays.asList(aoIds));

        return R.ok();
    }

}
